<?php

/* @var $this yii\web\View */
$this->registerJsFile('/js/jquery.min.js');
$this->registerJsFile('/js/jquery.cookie.js');

$this->registerCssFile('/css/indexpage/indexpage.css?v=1.0.25');
//$this->registerCssFile('/css/indexpage/carousel.css?v=1.0.0');//轮播图插件资源
//$this->registerJsFile('/js/indexpage/carousel.min.js');
$this->registerJsFile('/js/tools.js?v=1.0.1');
$this->registerJsFile('/js/layer/layer.js');
$this->registerJsFile('/js/common.websocket.js');
$this->registerJsFile('/js/indexpage/indexpage.js?v=1.0.25');

$this->title = '新格律--诗的摇篮，律的沃土。';
$this->metaTags[]="<meta name='keywords' content='现代诗,诗歌,歌词,现代诗歌,现代诗歌大全,现代诗歌精选,诗歌大全,新格律'/>";
$this->metaTags[]="<meta name='description' content='新格律（http://www.xingelv.com）为诗歌爱好者提供一个优质的服务平台，汇集广大诗歌文学人员提供发布诗歌的需求，交流，讨论，成为诗歌界最能够活跃的服务平台！'/>";
?>

<div class="indexpages" id="homepage">
    <div class="indexpage-category-outter">
        <div id="indexnav-items">	
	<ul class="list">
            <li class="item indexpage-category-item" id="category-scroll--1" data-id='-1'>关注</li>
            <li class="item indexpage-category-item indexpage-category-item-selected" id="category-scroll-0" data-id='0'>热门</li>
                <?php foreach($categories as $category){ ?>
                <li class="item indexpage-category-item" id="category-scroll-<?= $category['id']?>" data-id='<?= $category['id']?>'><?= $category['name']?></li>
                <?php }?>
	</ul>
        </div>
        <div class="indexnav-arrow-outter" id="indexnav-arrow">
            <div class="more-unclick" id="more-arrow"></div>
        </div>
    </div>
    <div class="indexpage-all-category-outter" id="indexpage-all-category-outter">
        <div class="indexpage-all-category-item" data-id="-1">关注</div>
        <div class="indexpage-all-category-item" data-id="0">热门</div>
        <?php foreach($categories as $category){ ?>
        <div class="indexpage-all-category-item" data-id="<?= $category['id']?>"><?= $category['name']?></div>
        <?php }?>
    </div>
    <div class="indexpage-works" id="indexpage-works">
    <?php foreach($topTenWorks as $work){ ?>
        <div class="works-outter">
            <div class="works-head">
                <a href="/user/home?id=<?= $work['authorid']?>">
                <div class="headimg-area">
                    <img src="<?= $work['userheadimg']?>" class="works-user-headimg"/>
                </div>
                <div class="works-auther">
                    <div class="auther-name"><?= $work['author']?></div>
                    <div class="works-time"><?= $work['addtime']?></div>
                </div>
                </a>
            </div>
            <div class="works-body">
                <a href="/works/detail?worksid=<?= $work['id']?>">
                <div class="works-title">
                    《<?= $work['title']?>》
                </div>
                <div class="works-content" data-id="<?= $work['id']?>"><?= $work['content']?></div>
                </a>
            </div>
            <div class="comment-area">
                <span class="comment-button"  data-id="<?= $work['id']?>" data-title="<?= $work['title']?>" data-author="<?= $work['author']?>" data-authorid="<?= $work['authorid']?>"></span><span class="comment-num" id="commentnum_<?= $work['id']?>" data-id="<?= $work['id']?>"><?= $work['comment_num']?></span><span class="shoucang <?php echo $work['is_collection'] == 1 ?  "collectioned":"uncollectioned";?>" id="like-<?= $work['id']?>" data-id="<?= $work['id']?>"></span><span class="comment-num" id="collectnum_<?= $work['id']?>" data-id="<?= $work['id']?>"><?= $work['collect_num']?></span>
            </div>
        </div>
    <?php }?>
    </div>
    <div class="works-none" id="works-none">没有啦~</div>
</div>
<div class="indexpages" id="friendpage">
    <div class="friend-add" id="friend-add">添加好友</div>
    <div class="friends-list" id="friends-list">
    <?php foreach($friends_list as $friend){ ?>
        <div class="friend-item" data-chatid="<?= $friend['chatid']?>" data-head="<?= $friend['headimg']?>" data-remarks="<?= $friend['remarks']?>">
            <div class="friend-head-area"><img class="headimg" src="<?= $friend['headimg']?>"/></div>
            <div class="friend-body-area"><?= $friend['remarks']?></div>
        </div>
    <?php }?>
    </div>
    
</div>
<div class="indexpages" id="publishpage">
    <div class="publish-remind-title">现代诗作品发布</div>

    <div class="works-publish-item-outer">
        <div class="works-publish-item-title"><input type="text" name="title" id="title" placeholder="请输入诗歌标题"/></div>
    </div>
    <div class="works-publish-item-outer">选择类型：
            <select class="works-publish-item-category" name="category" id="category">
                <?php foreach($categories as $category){ ?>
                <option value="<?= $category['id']?>"><?= $category['name']?></option>
                <?php }?>
                
            </select>
    </div>
    <div class="works-publish-item-outer">
        <div class="works-item-content">
            <textarea name="content" id="content" placeholder="请输入诗歌内容"></textarea>
        </div>
    </div>
    <div class="works-publish-item-outer">
        <div class="submit" id="publish-submit">发布</div>
    </div>
</div>
<div class="indexpages" id="msgpage">
    <!--好友请求消息begin-->
    <div id="friends-request-outter">
    <?php 
    if(!empty($friends_request_msg)){
        foreach($friends_request_msg as $new_msg){ ?>
        <div class="request-msg-list" id="request-msg-list-<?= $new_msg['id']?>">
            <div class="request-msg-title">好友申请</div>
            <div class="request-msg-list-headimg-outter"><img class="request-msg-headimg" src="<?= $new_msg['headimg']?>"/></div>
            <div class="request-msg-list-username-outter" id="request-msg-list-content-<?= $new_msg['id']?>">
                <span class="request-msg-list-username"><?= $new_msg['username']?></span>
                <span class="request-msg-list-addtime"><?= $new_msg['addtime']?></span>
            </div>
            <div class="request-msg-list-option-outter">
                <span class="request-msg-list-option-accept" data-id="<?= $new_msg['id']?>">接受</span>
                <span class="request-msg-list-option-refuse" data-id="<?= $new_msg['id']?>">拒绝</span>
            </div>
        </div>
        <?php }
    }
    ?>
    </div>
    <!--好友请求消息end-->
    <!--作品评论消息begin-->
    <div id="works-msg-outter">
    <?php 
    if(!empty($latestMsg)){
        foreach($latestMsg as $new_msg){ ?>
        <div class="unread-msg-list" id="unread-msg-list-<?= $new_msg['worksid']?>">
            <a href="/works/detail?worksid=<?= $new_msg['worksid']?>"><div class="unread-msg-list-totalnum" id="unread-msg-list-totalnum-<?= $new_msg['worksid']?>"><span class="number-box"><?= $new_msg['totalnum']?></span></div>
            <div class="unread-msg-list-content" id="unread-msg-list-content-<?= $new_msg['worksid']?>"><?= $new_msg['content']?></div>
            <div class="unread-msg-list-title" id="unread-msg-list-title-<?= $new_msg['worksid']?>">《<?= $new_msg['title']?>》</div>
            <div class="unread-msg-list-addtime" id="unread-msg-list-addtime-<?= $new_msg['worksid']?>"><?= $new_msg['addtime']?></div></a>
        </div>
        <?php }
    }
    ?>
    </div>
    <!--作品评论消息end-->
    <!--好友聊天消息begin-->
    <div class="friends-msg-outter" id="friends-msg-outter">
        <?php 
    if(!empty($friends_chat)){
        foreach($friends_chat as $friend_chat){ ?>
        <div class="chat-msg-list" id="chat-msg-list-<?= $friend_chat['id']?>" data-id="<?= $friend_chat['id']?>">
            <div class="chat-friend-head-outter">
                <img class="chat-friend-headimg" src="<?= $friend_chat['friend_headimg']?>"/>
                <span class="friend-unreadnum <?php echo $friend_chat['unreadnum']==0 ?  "no-unread" : "";?>" id="friend-unreadnum-<?= $friend_chat['id']?>"><?= $friend_chat['unreadnum']?></span></div>
            <div class="chat-friend-body-outter">
                <span class="friend-name"><?= $friend_chat['friend_name']?></span>
                <span class="friend-msg" id="friend-msg-<?= $friend_chat['id']?>"><?= $friend_chat['lastmsg']['content']?></span>
            </div>
            <div class="chat-time-outter" id="chat-time-outter-<?= $friend_chat['id']?>"><?= $friend_chat['lasttime']?></div>
        </div>
        <?php }
    }
    ?>
    </div>
    <!--好友聊天消息end-->
    <?php if($have_chat == 0){ ?>
        <div class="msg-none" id="msg-none">暂无消息</div>
    <?php }?>
    
</div>
<!--<div class="indexpages" id="minepage">
    <div class="user-default-head">
        <div class="user-headimg"><a href="/user/default/setheadimg"><img class="headimg" id="mine-headimg" src="/img/user/default-head.png"/></a></div>
        <div class="user-name" id="user-name"></div>
    </div>
    <div class="user-default-body">
        <div class="total-view">
            <div class="item">
                <div class="name">作品</div>
                <div class="num"><a href="/works/mine" id="mine-works-num"></a></div>
            </div>
            <div class="item">
                <div class="name">收藏</div>
                <div class="num"><a href="/user/footmark" id="mine-collect-num"></a></div>
            </div>
        </div>
        <div class="normal-item-outter"><div class="normal-item">手机：未绑定，去绑定</div></div>
        <div class="logout-button">
            <form id="logout-form" action="/site/logout" method="post"><font id="logout-submit">退&nbsp;出</font></form></div></div>
    <div class="user-default-footer"></div>
</div>-->


<div class="footer-box">
    <a href="#home"><div class="footer-item"><div class=" footer-index-selected" id="button-page-index">首页</div></div></a>
    <a href="#friend"><div class="footer-item"><div class="" id="button-page-friends">好友</div></div></a>
    <a href="#publish"><div class="footer-item"><div class="" id="button-page-publish"></div></div></a>
    <a href="#msg"><div class="footer-item"><div class="" id="button-page-msg">消息<span id="msg-num" class="msg-num"><?= $unreadMsgNum?></span></div></div></a>
    <a href="/user/default/index"><div class="footer-item"><div class="" id="button-page-mine">我</div></div></a>
</div>
<div class="bottom-blank">&nbsp;</div>